package com.bjpowernode.dao.impl;

import com.bjpowernode.dao.AccountDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Repository;

@Repository
public class AccountDaoImpl implements AccountDao {
    @Autowired
    //private QueryRunner queryRunner;
    private JdbcTemplate jdbcTemplate;

    //@Autowired
    //private JDBCUtils jdbcUtils;

    public void updateBalance(String no, int money) {
        String sql = "update account set balance=balance+? where no=?";
        try {
            jdbcTemplate.update(sql, money, no);
        } catch (Exception e) {
            e.printStackTrace();
            throw new RuntimeException(e);
        }
    }
}
